package com.yujn.product.controller;

import com.yujn.common.bean.Result;
import com.yujn.product.bean.ProductDO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/product")
@RestController
public class ProductController {

    /**
     * 根据产品ID获取产品
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result<ProductDO> getUserById(@PathVariable("id") String id) throws InterruptedException {
        ProductDO product = new ProductDO();
        product.setId(id);
        Thread.sleep(2000);
        return Result.success(product);
    }
}
